package com.cy.pj.category.service.impl;

import com.cy.pj.category.dao.CategoryDao;
import com.cy.pj.category.pojo.Category;
import com.cy.pj.category.service.CategoryService;
import com.cy.pj.common.annotation.RequiredCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Cx
 * @stage secondStageOfWeb
 * @creat 2020-11-11 17:04
 */
@Service
public class CategoryServiceImpl implements CategoryService {

    @Autowired(required = false)
    private CategoryDao categoryDao;

    @RequiredCache
    @Override
    public List<Category> findCategory() {
        List<Category> list = categoryDao.findCategory();
        return list;
    }

    @Override
    public int insertCategory(Category category) {
        Category c = new Category();
        c.setId(13);
        c.setName("D");
        c.setParentId(null);
        c.setRemark("D");
        return categoryDao.insertCategory(c);
    }

}
